package com.example.wuqujingdianphone.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.wuqujingdianphone.R;
import com.example.wuqujingdianphone.api.ApiConfig;
import com.example.wuqujingdianphone.bean.HomeFenBean;
import com.example.wuqujingdianphone.view.CircleImageView;

import java.util.List;


public class HomeFenleiAdapter extends BaseQuickAdapter<HomeFenBean.DataBean, BaseViewHolder> {
    private Context context;

    public HomeFenleiAdapter(Context context, int layoutResId, List data) {
        super(layoutResId, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, HomeFenBean.DataBean item) {
        helper.setText(R.id.fenlei_tv, item.getModuleName());
        Glide.with(mContext)
                .load(item.getModuleIcon())
//                .error(R.drawable.icon_book_cover_defalt)
//                .placeholder(R.drawable.icon_book_cover_defalt)
                .into((CircleImageView) helper.getView(R.id.fenlei_iv));
//        int pos = helper.getAdapterPosition();

//        switch (pos) {
//            case 0:
//                helper.setImageResource(R.id.fenlei_iv, R.mipmap.yuexiang);
//                break;
//            case 1:
//                helper.setImageResource(R.id.fenlei_iv, R.mipmap.tingshu);
//                break;
//            case 2:
//                helper.setImageResource(R.id.fenlei_iv, R.mipmap.qikan);
//                break;
//            case 3:
//                helper.setImageResource(R.id.fenlei_iv, R.mipmap.rixi);
//                break;
//            case 4:
//                helper.setImageResource(R.id.fenlei_iv, R.mipmap.tiyan);
//                break;
//            case 5:
//                helper.setImageResource(R.id.fenlei_iv, R.mipmap.shuyouhui);
//                break;
//            case 6:
//                helper.setImageResource(R.id.fenlei_iv, R.mipmap.shujia_iv);
//                break;
//            case 7:
//                helper.setImageResource(R.id.fenlei_iv, R.mipmap.qscan_iv);
//                break;
//        }
        //GlideUtil.loadImgSimple(context, item.getThumb(), (CircleImageView) helper.getView(R.id.fenlei_iv));
    }

}
